App({
  onLaunch: function () {
    let that = this;
    try {
      //验证登陆
      this.user.checkLogin().then(res => {
        console.log('app login true')
        that.globalData.token = wx.getStorageSync('token');
      }).catch(() => {
        console.log('app login false')
      });
      //本地存储
      let StorageInfo = wx.getStorageInfoSync()
      console.log(StorageInfo);
    } catch (e) {

    }
  },
  globalData: {
    // 基本信息
    version: 'App版本:V2.0.3-2019年1月23日',
    title:'海南建材直购',
    desc:'精选海南建材品牌商品，提供线上选购、线下安装售后，以优质服务为您省心、省钱！',
    // 用户信息
    userInfo: {
      avatar: '/static/images/avatar.png',
      nickname: 'Hi,游客',
      user_id: "",
      username: '点击去登录',
    },
    token: '',
    // 图片CDN
    ImgRootUrl: 'https://ledc-1251087221.file.myqcloud.com/',
    // 刷新首页标志
    Refresh:false,
    // 购物车列表
    cartList: {
      goods: [],
      product: []
    },
    // 购物车内商品数量
    cartGoodsCount: null,
  },
  // 载入：api、缓存、购物车、支付、用户、公共方法
  api: require('./config/api.js'),
  cache: require('./services/cache.js'),
  cart: require('./services/cart.js'),
  pay: require('./services/pay.js'),
  user: require('./services/user.js'),
  util: require('./utils/util.js'),
})